package org.jshand;

import org.jshand.service.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.jshand.dao.UserDao;

@Configuration
@ComponentScan("com.neuedu.controller")
public class OtherConfig {


    @Bean   //默认的Bean的名称是方法的名字(userDao)
    UserDao userDao(){
        return new UserDao();
    }

    //@Bean  //(默认的名字： getService)
    @Bean (name="userService")
    UserService getService(UserDao userDao){
        System.out.println("容器中图的 userDao = " + userDao);
        return new UserService(userDao);
    }



}
